﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESpace;

namespace ESpace_Project
{
    public partial class FormBmp : Form
    {
        Bitmap bmp;
       
        public FormBmp()
        {
            InitializeComponent();
            
            im.Image = EBmp.ConvertBMPTo32bit((Bitmap)im.Image);
            bmp = (Bitmap)im.Image.Clone();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.ConvertToGray(bmp);
            im.Refresh();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            im.Image = bmp;
            im.Refresh();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.ConvertToBW(bmp);
            im.Refresh();
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
          
            byte porog = (byte)trackBar1.Value;
            im.Image = EBmp.ConvertToBW(bmp,porog);
            im.Refresh();
            
        }

        private void button4_Click(object sender, EventArgs e)
        {
            im1.Image = EBmp.Resize((Bitmap)im.Image, im1.Width, im1.Height);
            im1.Refresh();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.Rotate180((Bitmap)im.Image);
            im.Refresh();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.Rotate90Clockwise((Bitmap)im.Image);
            im.Refresh();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.Rotate90Anticlockwise((Bitmap)im.Image);
            im.Refresh();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.FlipVert((Bitmap)im.Image);
            im.Refresh();
        }

        private void button9_Click(object sender, EventArgs e)
        {
            im.Image = EBmp.FlipHorz((Bitmap)im.Image);
            im.Refresh();
        }
    }
}
